package com.weixin.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.handlers.BeanHandler;

import com.weixin.dao.ILoginDao;
import com.weixin.util.C3p0Util;
import com.weixin.vo.Admin;
/**
 * 登陆验证实现类
 * @author Tangxinming
 *
 */
public class LoginDaoImpl implements ILoginDao{
	/**
	 * 登陆验证，查找数据中是否有记录
	 * @param admin_count 管理员账号
	 * @param admin_pwd 管理员密码
	 * @return 返回管理员信息
	 * @throws SQLException 抛出的异常
	 */
	@Override
	public Admin selectAdmin(String admin_account, String admin_pwd) throws SQLException {
		return C3p0Util.qr.query("select admin_account,admin_pwd,admin_img,admin_name,role_name from admin_table left join role_table on admin_table.role_id=role_table.role_id where admin_account=? and admin_pwd=?", new BeanHandler<Admin>(Admin.class),admin_account,admin_pwd);
	}

}
